#ifndef DEMO_GAMED3D
#define DEMO_GAMED3D

#include "Game.h"

struct Vertex
{
	D3DXVECTOR3 v3Pos;
	D3DXVECTOR3 v3Norm;
	Vertex(CONST D3DXVECTOR3& _v3Pos, CONST D3DXVECTOR3& _v3Norm)
		:v3Pos(_v3Pos),v3Norm(_v3Norm)
	{
	
	}
};
const D3DVERTEXELEMENT9 d3dve[] =
{
	{ 0,	0,	D3DDECLTYPE_FLOAT3,	D3DDECLMETHOD_DEFAULT,	D3DDECLUSAGE_POSITION,	0},
	{ 0,	12,	D3DDECLTYPE_FLOAT3,	D3DDECLMETHOD_DEFAULT,	D3DDECLUSAGE_NORMAL,	0},
	D3DDECL_END()
};

struct Geometry
{
	ID3DXMesh* dxm;
	D3DXMATRIX mWorld;
	D3DXVECTOR4 v4AM;
	D3DXVECTOR4 v4DM;
	D3DXVECTOR4 v4SM;
	FLOAT fSP;
};

struct PointLight
{
	D3DXVECTOR4 v4AI;
	D3DXVECTOR4 v4DI;
	D3DXVECTOR4 v4SI;
	D3DXVECTOR3 v3Pos;
	D3DXVECTOR3 v3Att;
};

class GameD3D : public Game
{
protected:
	IDirect3D9* d3d;
	IDirect3DDevice9* d3ddev;
	ID3DXBuffer* dxbuf;
	IDirect3DVertexDeclaration9* d3dvd;
	
	//Black Frame Effect
	ID3DXEffect* dxfx;

	RDList<Geometry*> geos;

	D3DXVECTOR3 v3ViewEye;
	D3DXVECTOR3 v3ViewTarget;
	D3DXVECTOR3 v3ViewUp;
	D3DXMATRIX mProj;

	D3DXVECTOR4 v4DLAI;
	D3DXVECTOR4 v4DLDI;
	D3DXVECTOR4 v4DLSI;
	D3DXVECTOR3 v3DLDir;
	RDList<PointLight*> points;

	virtual void Redraw();

public:
	GameD3D(LPCSTR title);
	virtual ~GameD3D();
};

#endif//DEMO_GAMED3D
